<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ProposalsModel>" %>
<%@ Import Namespace="FrontEnd.Models"%>

<asp:Content ID="HeadContent" ContentPlaceHolderID="Head" runat="server">
	<title>Proposals</title>
</asp:Content>

<asp:Content ID="MainContent" ContentPlaceHolderID="MainContent" runat="server">

	<script type="text/javascript">

		function IncrementUserAdds(box, proposalName) {
			var url = '<%= Url.RouteUrl(new {Action = "IncrementProposalUserAdds"})%>' + '/?proposalName=' + proposalName;
			
//			$.getJSON(url, {proposalName: proposalName},
//				function(data){
//					alert("Your vote stored. New value is " + data.ActualUserAdds);
//			});

			var html = $.ajax({
				url: url,
				dataType: "json",
				cache: false,
				success: function(msg) {
					box.innerHTML = msg.ActualUserAdds;					
				}
			})
		}
	
	</script>

	<div id="menu">
		
	</div>

	<hr />

    <h2>Proposals</h2>

    <% foreach (var proposal in Model.ProposalsPage) { %>   
     
		<% Html.RenderPartial("Proposal", proposal); %>
		
    <% } %>

</asp:Content>